import os

class Config(object):
    # SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:liu18311010@localhost:3306/final"

    DOWNLOAD_PATH = os.getcwd() + '/app/static/upload/download_file'
    DISPLAY_PATH = os.getcwd() + '/app/static/upload/display'
    SECRET_KEY = '123456'
    WTF_CSRF_SECRET_KEY = '123456'
    WTF_CSRF_CHECK_DEFAULT = False

    MAX_CONTENT_LENGTH = 16 * 1024 * 1024  # 文件最大限制16M,仅需配置
    ALLOWED_EXTENSIONS = set(['bmp', 'svg', 'png', 'jpg', 'jpeg', 'gif'])

    DEBUG = True

    DIALECT = 'mysql'
    DRIVER = 'pymysql'
    USERNAME = 'root'
    PASSWORD = 'liu18311010'
    HOST = '127.0.0.1'
    PORT = '3306'
    DATABASE = 'final'

    SQLALCHEMY_DATABASE_URI = '{}+{}://{}:{}@{}:{}/{}?charset=utf8'.format(DIALECT, DRIVER, USERNAME, PASSWORD, HOST,
                                                                           PORT,
                                                                           DATABASE)
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 将Config类作为参数传递到其他函数中,又希望在实例化Config类之前就能提供下列的功能,所以使用staticmethod.
    @staticmethod
    def init_app(app):
        pass